<html lang="zh-Hans">
<head>
	<meta charset="utf-8">
	<title>成员信息自助维护</title>
	<meta http-equiv="Cache-Control" content="no-cache" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" href="${rc.contextPath}/resources/amazeui/css/amazeui.min.css">
	<style type="text/css">
	.member{background-color:#FFF;border-radius:4px;border-width:1px;border-style:solid;border-color:#E7E7E7;margin:10px 0 20px;padding:15px 20px;
		font-size:20px;
		text-align: left;
	}
	.am-u-sm-1 {width: 3%;padding: 0;}
	.am-u-sm-10 {width: 94%;}
	.username{display: inline-block;}.username:before{content: '姓名：'}
	.phonenumber{display:inline-block;}.phonenumber:before{content: '联系方式：'}
	.remark:before{content: '成员介绍：'}
	@media only screen and (min-width:641px) {
		.am-u-md-3 {width: 25%;}
		.am-u-md-6 {width: 50%;}
	}
	</style>
</head>
<body style="background-color: #F4F4F4;font-family:Georgia,'Source Han Sans CN','Xin Gothic','Hiragino Sans GB','Microsoft YaHei';">
	<div id="id-main" class="am-g">
		<div class="am-u-sm-1 am-u-md-3">&nbsp;</div>
		<div class="am-u-sm-10 am-u-md-6">
			<div style="text-align: center;margin-top: 20px;color:#333333">
				<h1>成员信息自助维护</h1>
				<div class="member am-g">
					<form class="am-form" id="id-form">
					<input type="hidden" name="id" value="${member.id}"/>
					<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
					<input type="hidden" name="realname" value="${member.realname}"/>
					<div class="am-form-group">${member.realname}</div>
					<div class="am-form-group">
						<input name="phonenumber" type="text" value="${member.phonenumber}" data-validation-message="请输入符合规范的手机号码" pattern="^1[358][0-9]{9}$" required/>
					</div>
					<div class="am-form-group">
						<textarea name="remark" rows="10" data-validation-message="控制在150个字符以内" maxlength="150">${member.remark}</textarea>
					</div>
					<div class="am-form-group" style="text-align: center;">
						<button id="id-btn-submit" type="submit" class="am-btn am-btn-primary am-round" style="width: 200px;">修改</button>
					</div>
					</form>
				</div>
			</div>
		</div>
		<div class="am-u-sm-1 am-u-md-3">&nbsp;</div>
	</div>
	<script src="${rc.contextPath}/resources/js/jquery.min.js"></script>
	<script src="${rc.contextPath}/resources/amazeui/js/amazeui.min.js"></script>
	<script>
	$(function() {
		  $('#id-form').validator({
		    onValid: function(validity) {
		      $(validity.field).closest('.am-form-group').find('.am-alert').hide();
		    },
		    onInValid: function(validity) {
		      var $field = $(validity.field);
		      var $group = $field.closest('.am-form-group');
		      var $alert = $group.find('.am-alert');
		      // 使用自定义的提示信息 或 插件内置的提示信息
		      var msg = $field.data('validationMessage') || this.getValidationMessage(validity);
		
		      if (!$alert.length) {
		        $alert = $('<div class="am-alert am-alert-danger"></div>').hide().
		          appendTo($group);
		      }
		      $alert.html(msg).show();
		    },
		    validateOnSubmit: true,
		    submit:function(){
		    	if(this.isFormValid()){
					$.ajax({
		    			type:"post",
		    			url  : "${rc.contextPath}/lianyihui/edit", 
		    			data : $("#id-form").serialize(),
		    			success : function(result){
		    				if(result.resultCode == 0){
		    					window.location.href="${rc.contextPath}/memberlist";
		    				}else{
		    					alert(result.message);
		    				}
		    			},
		    			error : function(){alert("系统故障！")},
		    			dataType : "json"
		    		});
		    	}
				return false;
			}
		});
	});
	</script>
</body>
</html>